<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <br />
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>Hours/Days</th>
        <th>Sunday</th>
		<th>Monday</th>
		<th>Tuesday</th>
		<th>Wednesday</th>
		<th>Thursday</th>
		<th>Friday</th>
		<th>Saturday</th>
      </tr>
	  <tr>
		<th>9:00</th>
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[10 > number(@start)]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>10:00</th>
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[10 >= number(@start) and number(@end) > 10]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>11:00</th>
		
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[11 >= number(@start) and number(@end) > 11]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>12:00</th>
		
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[12 >= number(@start) and number(@end) > 12]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>13:00</th>
		
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[13 >= number(@start) and number(@end) > 13]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>14:00</th>
		
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[14 >= number(@start) and number(@end) > 14]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>15:00</th>
		
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[15 >= number(@start) and number(@end) > 15]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>16:00</th>
		
		<xsl:for-each select="timetable/day">
			<td><xsl:value-of select="course[16 > number(@start) and number(@end) > 16]/@title"/></td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>17:00</th>
		<xsl:for-each select="timetable/day">
			<td>
				<xsl:value-of select="course[17 >= number(@start) and number(@end) > 17]/@title"/>
				</td>
		</xsl:for-each>
	  </tr>
	  <tr>
		<th>18:00</th>
		<xsl:for-each select="timetable/day">
			<td>
				<xsl:if test="/course">
					<xsl:value-of select="course[18 >= number(@start) and number(@end) > 18]/@title"/>
				</xsl:if>
			</td>
		</xsl:for-each>
	  </tr>
	  

    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

